<template>
	<view class="pageContent">
		
		<!-- 	<u-navbar
				leftText="返回"
				title="店铺管理"
				:placeholder="true"
				:safeAreaInsetTop="true"
			>
				<view
					class="u-nav-slot"
					slot="left"
				>
					<u-icon
						name="arrow-left"
						size="19"
					></u-icon>
				 
				</view>
				<view
					:style="'right:'+systemInfo.menuButtonLeft+'px'" 
					slot="right"
				> 
					<button class="shareBtn" open-type="share">
						<image src="/static/t.png" mode=""></image>
					</button>
				</view>
			</u-navbar> -->
		<view class="top_box">
			<view class="sbox">
				<view class="item">
					<text class="text">总营收</text>
					<view class="n">
						<text class="num">{{info.totalCommission}}</text>
						<text class="t" v-if="info.totalCommission">元</text>
					</view>
				</view>
				<view class="item">
					<text class="text">本周营收</text>
					<view class="n">
						<text class="num">{{info.weekCommission}}</text>
						<text class="t" v-if="info.weekCommission">元</text>
					</view>
				</view>
				<view class="item">
					<text class="text">当日营收</text>
					<view class="n">
						<text class="num">{{info.todayCommission}}</text>
						<text class="t" v-if="info.todayCommission">元</text>
					</view>
				</view>
			</view>
			<view class="btn_box">
				<view class="btn1" @click="handleToCashList">
					提现记录
				</view>
				<view class="btn2" @click="handleToCash">
					提现
				</view>
			</view>
		</view>
		
		<view class="main_box">
			<view class="item" @click="handleToAuthPage('/pagesA/store/goods/index')">
				<image src="/static/user/icon5.png" mode=""></image>
				<text>商品管理</text>
			</view>
			<view class="item" @click="handleToAuthPage('/pagesA/store/order/index')">
				<image src="/static/user/icon3.png" mode=""></image>
				<text>订单管理</text>
			</view>
			<view class="item" @click="handleToAuthPage('/pagesA/store/reviews')">
				<image src="/static/user/icon6.png" mode=""></image>
				<text>评价管理</text>
			</view>
			<view class="item" @click="handleToAuthPage('/pagesA/purchase/index')">
				<image src="/static/user/icon4.png" mode=""></image>
				<text>定采专区</text>
			</view>
		</view>
		
		<button  open-type="share" class="shareBtn">
			<image src="/static/tt.png" mode=""></image>
			分享店铺
		</button>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				info:''
			}
		},
		onLoad() {
			this.getInfo()
		},
		
		computed:{
			systemInfo(){ 
				return uni.getStorageSync('systemInfo')	
			},
			userInfo() {
				return this.$store.state.userInfo 
			}
		},
		// 分享给好友的设置
		onShareAppMessage(res) {
			return {
				title: `${this.userInfo.nickname}邀请你下单`,
				path: `/pagesA/store/goods/index?storeId=${this.userInfo.id}`,
				imageUrl: '/static/storeShare.jpg',
				success(res) {
					uni.showToast({
						title: '分享成功'
					})
				},
				fail(res) {
					uni.showToast({
						title: '分享失败',
						icon: 'none'
					})
				}
			}
		},
		methods:{
			handleToCashList(){
				uni.navigateTo({
					url:"/pagesA/invitation/cash_list"
				})
			},
			handleToCash(){
				uni.navigateTo({
					url:"/pagesA/invitation/cash"
				})
			},
			getInfo(){
				this.$http({
					url:"/umsVaultDetail/add",
					method:"get",
				}).then(data=>{
					this.info = data
				})
			},
			handleToAuthPage(url){
				if(uni.getStorageSync('token')){
					uni.navigateTo({
						url
					})
				}else{
					uni.reLaunch({
						url:"/pages/user/login"
					})
				}
			}
		}
	}
</script>

<style>
	page{
		background: #f8f8f8;
	}
</style>

<style lang="scss" scoped>
	.u-nav-slot{
		display: flex;
		align-items: center;
	}
	.pageContent{
		padding: 30rpx;
	}
	.shareBtn{
		padding: 0;
		background: none;
		position: absolute;
		left: 0;
		width: 90%;
		padding: 10rpx 0;
		right: 0;
		margin: 0 auto;
		bottom: 60rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 30rpx;
		border-radius: 50rpx;
		background: #020202;
		color: #FFF;
		&::after{
			border: none;
		}
		image{
			display: block;
			width: 36rpx;
			height: 36rpx;
			margin-right: 24rpx;
		}
	}
	.main_box{
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		margin-top: 36rpx;
		.item{
			width: 49%;
			height: 170rpx;
			background: #fff;
			border-radius: 2rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			margin-bottom: 22rpx;
			image{
				width: 68rpx;
				height: 68rpx;
			}
			text{
				font-size: 24rpx;
				margin-top: 21rpx;
				color: #333;
			}
		}
	}
	.top_box{
		background: #fff;
		padding: 40rpx 0;
		.btn_box{
			display: flex;
			align-items: center;
			justify-content: center;
			margin-top: 50rpx;
			.btn1{
				width: 220rpx;
				height: 72rpx;
				background: #F8F8F8;
				border-radius: 50rpx;
				text-align: center;
				line-height: 72rpx;
				font-size: 26rpx;
				color: #020202;
				margin-right: 40rpx;
			}
			.btn2{
				width: 220rpx;
				height: 72rpx;
				background: #020202;
				border-radius: 50rpx;
				text-align: center;
				line-height: 72rpx;
				color: #fff;
				font-size: 26rpx;
				margin-left: 40rpx;
			}
		}
		.sbox{
			display: flex;
			align-items: center;
			justify-content: center;
			.item{
				width: 33%;
				border-right: 1px solid #DBDBDB;
				&:last-child{
					border-right:none;
				}
				.text{
					font-size: 24rpx;
					color: #999999;
					text-align: center;
					display: block;
					margin-bottom: 16rpx;
				}
				.n{
					display: flex;
					align-items: flex-end;
					justify-content: center;
					.num{
						font-size: 36rpx;
						color: #020202;
					}
					.t{
						font-size: 24rpx;
						margin-left: 6rpx;
						position: relative;
						top: -2px;
						color: #020202;
					}
				}
			}
		}
	}
</style>